from django.contrib import admin
from django.urls import path, include
from django.views.generic import RedirectView
from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
    path('admin/', admin.site.urls),
    # 将根路径重定向到数据源列表页面
    path('', RedirectView.as_view(pattern_name='datasource_list', permanent=False), name='home'),
    path('users/', include('users.urls')),
    path('subscriptions/', include('subscriptions.urls')),
    path('alarms/', include('alarms.urls')),
] 

if settings.DEBUG:
    urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) 